<extend name="Public/base" />

<!-- 子导航 -->
<block name="sidebar">
    <include file="sidemenu" />
</block>

<block name="body">
<link rel="stylesheet" href="__STATIC__/kindeditor/default/default.css" />

<script type="text/javascript">

function delthispic(obj,dataid){
	if(!confirm("确认删除此图？"))return false;
	/*var dataid=$(obj).attr('dataid');
	$('.input_upload_all').val($('.input_upload_all').val().replace(dataid, ""));*/
	var str='';
	list=$('#z_sliders').val();
	arr=list.split(',');
	for(var i=0;i<arr.length;i++)
	{
		if(arr[i]==dataid)continue;
		if(str=='')
		{
			str=arr[i];
		}
		else
		{
			str=str+','+arr[i];
		}
	}
	$('#z_sliders').val(str);
	$(obj).parent().remove();
}
</script>
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
			<script charset="utf-8" src="__STATIC__/kindeditor/kindeditor-min.js"></script>
			<script charset="utf-8" src="__STATIC__/kindeditor/zh_CN.js"></script>
	<div class="main-title cf">
		<h2>
			新增{$info.model_id|get_document_model='title'} [
			<volist name="rightNav" id="nav">
			<a href="{:U('Product/index','cate_id='.$nav['id'])}">{$nav.title}</a>
			<if condition="count($rightNav) gt $i"><i class="ca"></i></if>
			</volist>
			<present name="article">：<a href="{:U('article/index','cate_id='.$info['category_id'].'&pid='.$article['id'])}">{$article.title}</a></present>
			]
		</h2>
	</div>
	<!-- 标签页导航 -->
<div class="tab-wrap">
	<ul class="tab-nav nav">
		<li data-tab="tab0" <eq name="key" value="0">class="current"</eq>><a href="javascript:void(0);">基本信息</a></li>
		<!-- <volist name=":parse_config_attr($model['field_group'])" id="group">
			<li data-tab="tab{$key}"><a href="javascript:void(0);">{$group}</a></li>
		</volist> -->
		<li data-tab="tab{$key+1}"><a href="javascript:void(0);">规格信息</a></li>
		<?php
		$navnum=$key+1;
		?>
	</ul>
	<div class="tab-content">
		<!-- 表单 -->
		<form id="form" action="{:U('update')}" method="post" class="form-horizontal">
        <div id="tab0" class="tab-pane in tab0">
                <div class="form-item cf">
						<label class="item-label">基本属性<span class="check-tips"></span></label>
						<div class="controls">
                        <!-- <input type="checkbox" name="is_home" value="1">首页-->
                        <input type="checkbox" name="is_new" value="1">新品推荐 &nbsp;&nbsp;
                        <input type="checkbox" name="is_hot" value="1">热卖推荐 
						
						<label class="item-label">商品名称<span class="check-tips"></span></label>
						<div class="controls">
                        <input type="text" class="text input-large" name="title" value="">
						</div>

						<lable class="item-lable">商品标签</lable>
                        <div class="controls">
							<select name="tag_id" id="">
								<option value="1">企业点餐</option>
								<option value="2">拼团点餐</option>
								<option value="3" selected="selected">在线商城</option>
							</select>
						</div>

						<label class="item-label">市场价格<span class="check-tips"></span></label>
						<div class="controls">
                        <input type="text" class="text input-large" name="market_price" value="">
						</div>
						
						<label class="item-label">商城价格<span class="check-tips"></span></label>
						<div class="controls">
                        <input type="text" class="text input-large" name="gprice" value="">
						</div>
						
						<label class="item-label">库存数量<span class="check-tips"></span></label>
						<div class="controls">
                        <input type="text" class="text input-large" name="depot_num" value="">
						</div>
						
						<label class="item-label">销售数量<span class="check-tips"></span></label>
						<div class="controls">
                        <input type="text" class="text input-large" name="sell_num" value="0">
						</div>
						<!-- 
						<label class="item-label">分享金额<span class="check-tips"></span></label>
						<div class="controls">
                        <input type="text" class="text input-large" name="share_money" value="0">
						</div> -->


						
						<label class="item-label">推荐语<span class="check-tips"></span>
						</label>
						<div class="controls">
						<textarea name="description" cols=60 rows=5></textarea>
						<!-- <script type="text/javascript">
							var editor2;
							KindEditor.ready(function(K) {
								editor2 = 
								K.create('textarea[name="description"]', {
									allowFileManager : false,
									themesPath: K.basePath,
									width: '80%',
									height: '300px',
									resizeType: 2,
									pasteType : 2,
									urlType : 'absolute',
									fileManagerJson : "{:U('fileManagerJson')}",
									uploadJson : '{:addons_url("EditorForAdmin://Upload/ke_upimg")}'
								});
							});
							$(function(){
								//传统表单提交同步
								$('textarea[name="description"]').closest('form').submit(function(){
									editor2.sync();
								});
								//ajax提交之前同步
								$('button[type="submit"],#submit,.ajax-post').click(function(){
									editor2.sync();
								});
							})
						
						</script> -->
						</div>
						<label class="item-label">商品详情<span class="check-tips"></span>
						</label>
						<div class="controls">
						<textarea name="content">{$field.value}</textarea>
						</div>
						{:hook('adminArticleEdit', array('name'=>'content','value'=>$field['value']))}

						<label class="item-label2">
							商品主图<span class="check-tips">（比例为1:1，建议尺寸不小于720*720px）</span>
						</label>
						<div class="controls">
							<div class="controls">
								<input type="file" id="z_img">
								<input type="hidden" name="image" id="z_img_id" value=""/>
								<div class="upload-img-box"></div>
							</div>
							<script type="text/javascript">
								//上传图片
								/* 初始化上传插件 */
								$("#z_img").uploadify({
									"height"          : 30,
									"swf"             : "/Public/static/uploadify/uploadify.swf",
									"fileObjName"     : "download",
									"buttonText"      : "上传图片",
									"uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
									"width"           : 120,
									'removeTimeout'	  : 1,
									'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
									"onUploadSuccess" : z_img_id,
									'onFallback' : function() {
										alert('未检测到兼容版本的Flash.');
									}
								});
								function z_img_id(file, data){
									var data = $.parseJSON(data);
									var src = '';
									if(data.status){
										$("#z_img_id").val(data.path);
										src = data.url || '' + data.path
										$("#z_img_id").parent().find('.upload-img-box').html(
											'<div class="upload-pre-item"><img src="' + src + '"/></div>'
										);
									} else {
										updateAlert(data.info);
										setTimeout(function(){
											$('#top-alert').find('button').click();
											$(that).removeClass('disabled').prop('disabled',false);
										},1500);
									}
								}
							</script>
						</div>
						
						<label class="item-label2">
							首页主图<span class="check-tips">（建议尺寸720*300px）</span>
						</label>
						<div class="controls">
							<div class="controls">
								<input type="file" id="z_img1">
								<input type="hidden" name="home_image" id="z_img_id1" value=""/>
								<div class="upload-img-box"></div>
							</div>
							<script type="text/javascript">
								//上传图片
								/* 初始化上传插件 */
								$("#z_img1").uploadify({
									"height"          : 30,
									"swf"             : "/Public/static/uploadify/uploadify.swf",
									"fileObjName"     : "download",
									"buttonText"      : "上传图片",
									"uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
									"width"           : 120,
									'removeTimeout'	  : 1,
									'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
									"onUploadSuccess" : z_img_id1,
									'onFallback' : function() {
										alert('未检测到兼容版本的Flash.');
									}
								});
								function z_img_id1(file, data){
									var data = $.parseJSON(data);
									var src = '';
									if(data.status){
										$("#z_img_id1").val(data.path);
										src = data.url || '' + data.path
										$("#z_img_id1").parent().find('.upload-img-box').html(
											'<div class="upload-pre-item"><img src="' + src + '"/></div>'
										);
									} else {
										updateAlert(data.info);
										setTimeout(function(){
											$('#top-alert').find('button').click();
											$(that).removeClass('disabled').prop('disabled',false);
										},1500);
									}
								}
							</script>
						</div>
						<label class="item-label2">
							商品细节图<span class="check-tips">（比例为1:1，建议尺寸不小于720*720px）</span>
						</label>
						<div class="controls">
							<div class="controls">
								<input type="file" id="sliders">
								<input type="hidden" name="imglist" id="z_sliders" value=""/>
								<div class="upload-img-box"></div>
							</div>
							<script type="text/javascript">
								//上传图片
								/* 初始化上传插件 */
								$("#sliders").uploadify({
									"height"          : 30,
									"swf"             : "/Public/static/uploadify/uploadify.swf",
									"fileObjName"     : "download",
									"buttonText"      : "上传图片",
									"uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
									"width"           : 120,
									'removeTimeout'	  : 1,
									'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
									"onUploadSuccess" : z_sliders_id,
									'onFallback' : function() {
										alert('未检测到兼容版本的Flash.');
									}
								});
								function z_sliders_id(file, data){
									var data = $.parseJSON(data);
									var src = '';
									if(data.status){
										imglist=$('#z_sliders').val();
										if(imglist=='')
										{
											imglist=data.id;
										}
										else
										{
											imglist=imglist+','+data.id;
										}
										$('#z_sliders').val(imglist);
										src = data.url || '' + data.path
										$("#z_sliders").parent().find('.upload-img-box').append(
											'<div class="upload-pre-item1"><img src="' + src + '" width="100" height="100" onclick="delthispic(this,'+data.id+')"/></div>'
										);
									} else {
										updateAlert(data.info);
										setTimeout(function(){
											$('#top-alert').find('button').click();
											$(that).removeClass('disabled').prop('disabled',false);
										},1500);
									}
								}
								</script>
						</div>
						
						<label class="item-label">排列序号<span class="check-tips"></span></label>
						<div class="controls">
                        <input type="text" class="text input-large" name="order_num" value="0">
						</div>
					</div>
				</div>
		</div>
		<!-- 基础文档模型 -->
		<volist name=":parse_config_attr($model['field_group'])" id="group">
        <div id="tab{$key}" class="tab-pane tab{$key}">
            <volist name="fields[$key]" id="field" key="knum">
			<?php
			$nknum++;
			?>
                <div class="form-item cf">
                    <label class="item-label">{$field['title']}<span class="check-tips"><notempty name="field['remark']">（{$field['remark']}）</notempty></span></label>
                    <div class="controls">
                        <switch name="field.type">
                            <case value="num">
                                <input type="text" class="text input-medium" name="{$field.name}" value="{$field.value}">
                            </case>
                            <case value="string">
                                <input type="text" class="text input-large" name="{$field.name}" value="{$field.value}">
                            </case>
                            <case value="textarea">
                                <label class="textarea input-large">
                                <textarea name="{$field.name}">{$field.value}</textarea>
                                </label>
                            </case>
                            <case value="datetime">
                                <input type="text" name="{$field.name}" class="text input-large time" value="" placeholder="请选择时间" />
                            </case>
                            <case value="bool">
                                <select name="{$field.name}">
                                    <volist name=":parse_field_attr($field['extra'])" id="vo" key="key1">
                                        <option value="{$key}" <eq name="field.value" value="$key">selected</eq>>{$vo}</option>
                                    </volist>
                                </select>
                            </case>
                            <case value="select">
                                <select name="{$field.name}">
                                    <volist name=":parse_field_attr($field['extra'])" id="vo" key="key2">
                                        <option value="{$key}" <eq name="field.value" value="$key">selected</eq>>{$vo}</option>
                                    </volist>
                                </select>
                            </case>
							<case value="brand">
							<!--{:parse_brand($field['name'])}-->
							</case>
                            <case value="radio">
                                <volist name=":parse_field_attr($field['extra'])" id="vo" key="key4">
                                	<label class="radio">
                                    <input type="radio" value="{$key}" <eq name="field.value" value="$key">checked</eq> name="{$field.name}">{$vo}
                                	</label>
                                </volist>
                            </case>
                            <case value="checkbox">
                                <volist name=":parse_field_attr($field['extra'])" id="vo" key="key5">
                                	<label class="checkbox">
                                    <input type="checkbox" value="{$key}" name="{$field.name}" <eq name="field.value" value="$key">checked</eq>>{$vo}
                                	</label>
                                </volist>
                            </case>
                            <case value="editor">
                                <label class="textarea">
                                <textarea name="{$field.name}">{$field.value}</textarea>
                                {:hook('adminArticleEdit', array('name'=>$field['name'],'value'=>$field['value']))}
                                </label>
                            </case>
                            <case value="picture">
                                <div class="controls">
									<input type="file" id="upload_picture_{$field.name}">
									<input type="hidden" name="{$field.name}" id="cover_id_{$field.name}"/>
									<div class="upload-img-box">
									<notempty name="data[$field['name']]">
										<div class="upload-pre-item"><img src="{$data[$field['name']]|get_cover='path'}"/></div>
									</notempty>
									</div>
								</div>
								<script type="text/javascript">
								//上传图片
							    /* 初始化上传插件 */
								$("#upload_picture_{$field.name}").uploadify({
							        "height"          : 30,
							        "swf"             : "__STATIC__/uploadify/uploadify.swf",
							        "fileObjName"     : "download",
							        "buttonText"      : "上传图片",
							        "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
							        "width"           : 120,
							        'removeTimeout'	  : 1,
							        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
							        "onUploadSuccess" : uploadPicture{$field.name},
							        'onFallback' : function() {
							            alert('未检测到兼容版本的Flash.');
							        }
							    });
								function uploadPicture{$field.name}(file, data){
							    	var data = $.parseJSON(data);
							    	var src = '';
							        if(data.status){
							        	$("#cover_id_{$field.name}").val(data.id);
							        	src = data.url || '__ROOT__' + data.path
							        	$("#cover_id_{$field.name}").parent().find('.upload-img-box').html(
							        		'<div class="upload-pre-item"><img src="__ROOT__' + src + '"/></div>'
							        	);
							        } else {
							        	updateAlert(data.info);
							        	setTimeout(function(){
							                $('#top-alert').find('button').click();
							                $(that).removeClass('disabled').prop('disabled',false);
							            },1500);
							        }
							    }
								</script>
                            </case>
                            <case value="file">
								<div class="controls">
									<input type="file" id="upload_file_{$field.name}">
									<input type="hidden" name="{$field.name}" value="{$data[$field['name']]}"/>
									<div class="upload-img-box">
										<present name="data[$field['name']]">
											<div class="upload-pre-file"><span class="upload_icon_all"></span>{$data[$field['name']]}</div>
										</present>
									</div>
								</div>
								<script type="text/javascript">
								//上传图片
							    /* 初始化上传插件 */
								$("#upload_file_{$field.name}").uploadify({
							        "height"          : 30,
							        "swf"             : "__STATIC__/uploadify/uploadify.swf",
							        "fileObjName"     : "download",
							        "buttonText"      : "上传附件",
							        "uploader"        : "{:U('File/upload',array('session_id'=>session_id()))}",
							        "width"           : 120,
							        'removeTimeout'	  : 1,
							        "onUploadSuccess" : uploadFile{$field.name},
							        'onFallback' : function() {
							            alert('未检测到兼容版本的Flash.');
							        }
							    });
								function uploadFile{$field.name}(file, data){
									var data = $.parseJSON(data);
							        if(data.status){
							        	var name = "{$field.name}";
							        	$("input[name="+name+"]").val(data.data);
							        	$("input[name="+name+"]").parent().find('.upload-img-box').html(
							        		"<div class=\"upload-pre-file\"><span class=\"upload_icon_all\"></span>" + data.info + "</div>"
							        	);
							        } else {
							        	updateAlert(data.info);
							        	setTimeout(function(){
							                $('#top-alert').find('button').click();
							                $(that).removeClass('disabled').prop('disabled',false);
							            },1500);
							        }
							    }
								</script>
                            </case>
                            <default/>
                            <input type="text" class="text input-large" name="{$field.name}" value="{$field.value}">
                        </switch>
                    </div>
                </div>
            </volist>
        </div>
		</volist>
			<input type="hidden" name="id" value="{$info.id|default=''}"/>
			<input type="hidden" name="pid" value="{$info.pid|default=''}"/>
			<input type="hidden" name="model_id" value="{$info.model_id|default=''}"/>
			<input type="hidden" name="category_id" value="{$info.category_id|default=''}">
			<input type="hidden" id="attrs_titles" name="attrs_titles" value="" />
			<input type="hidden" id="attrs_values" name="attrs_values" value="" />
		<!--</form>
		<form id="attr_form" action="" method="post">-->
		<div id="tab{$navnum}" class="tab-pane tab{$navnum}">
			<div class="form-item cf">
				<!-- <label class="item-label">属性名称<span class="check-tips"></span></label> -->
				规格名称：<input type="text" class="text" id="attr_title" value="">&nbsp;&nbsp;
				规格值：<span class="check-tips"></span></label>
				<input type="text" class="text" id="attr_value" value="">(以=进行分隔)<a class="btn" onclick="return addattr()">新增</a>
			</div><br>
			<div id='attr_str'>
			<!--<a class="btn">颜色</a>-->
			</div><br>
			<div id='attr_html'>
			<!--
			<span id="pos_"><label class="item-label2">红色</label>&nbsp;&nbsp;普通价格<input type="text" name="price[0][]" class="text input" value="0">
			VIP价格<input type="text" name="price[0][]" class="text input" value="0"></span>-->
			</div>
			<input type="hidden" id="attr_titles" name="attr_titles" value="" />
			<input type="hidden" id="attr_values" name="attr_values" value="" />
		</div>
		</form>
		<br />
		<div class="form-item cf">
			<button class="btn submit-btn ajax-post hidden" id="button" type="submit" target-form="form-horizontal" disabled>确 定</button>
			<a class="btn btn-return" href="{:U('Product/index?cate_id='.$cate_id)}">返 回</a>
		</div>
	</div>
</div>
<script>
$(function(){
	$('input[name="title"]').blur(function(){
		if ($(this).val()=="") {
			$('.check-tips').css('color','red');
			$('.check-tips').eq(1).html('商品名称不能为空！');return;
		}else{
			$('.check-tips').eq(1).html('')
			$("#button").removeAttr("disabled");
		}
	});
	$('input[name="gprice"]').blur(function(){
		if ($(this).val()=="") {
			$('.check-tips').css('color','red');
			$('.check-tips').eq(3).html('商城价格不能为空！');return;
		}else if ($(this).val()<=0){
			$('.check-tips').css('color','red');
			$('.check-tips').eq(3).html('商城价格需大于0！');return;
		}else{
			$('.check-tips').eq(3).html('')
			$("#button").removeAttr("disabled");
		}
	});
	$('input[name="depot_num"]').blur(function(){
		if ($(this).val()=="") {
			$('.check-tips').css('color','red');
			$('.check-tips').eq(4).html('库存数量不能为空！');return;
		}else if($(this).val()<=0){
			$('.check-tips').css('color','red');
			$('.check-tips').eq(4).html('库存数量不需大于0！');return;
		}else{
			$('.check-tips').eq(4).html('')
			$("#button").removeAttr("disabled");
		}
	});
})
function delitem(title,id)
{
	if(confirm("确认删除"+title+"?"))
	{
		var titles=$('#attr_titles').val().split(',');
		var str='';
		var key=0;
		for(var i=0;i<titles.length;i++)
		{
			if(title==titles[i])
			{
				key=i;
				continue;
			}
			if(str=='')
			{
				str=titles[i];
			}
			else
			{
				str+=','+titles[i];
			}
		}
		$('#attr_titles').val(str);
		str='';
		var values=$('#attr_values').val().split(',');
		for(var i=0;i<values.length;i++)
		{
			if(key==i)
			{
				key=i;
				continue;
			}
			if(str=='')
			{
				str=values[i];
			}
			else
			{
				str+=','+values[i];
			}
		}
		$('#attr_values').val(str);
		$('#item_'+id).remove();
		var attrform = $('.form-horizontal');
		var query = attrform.serialize();
		//alert(query);
		$.post("__URL__/getattrlist",query).success(function(data){
			if (data.status==1) {
				//updateAlert(data.attr_str ,'alert-success');
				$('#attr_str').html(data.attr_str);
				$('#attr_html').html(data.attr_html);
			}else{
				updateAlert(data.info);
			}
			setTimeout(function(){
				$('#top-alert').find('button').click();
			},1500);
		})
	}
}
var num=0;
var str='';
var attr_title='';
var attr_value='';
var attr_stock = '';
function addattr()
{
	attr_title = $.trim($('#attr_title').val());
	attr_value = $.trim($('#attr_value').val());
	//attr_stock = $.trim($('#attr_stock').val());
	if(attr_title==''){
		alert('请输入属性名称');return;
	}else if(attr_value==''){
		alert('请输入属性值');return;
	}else{
		num++;
		if($('#attr_titles').val()==''){
			$('#attr_titles').val(attr_title);
		}else{
			$('#attr_titles').val($('#attr_titles').val()+','+attr_title);
		}
		if($('#attr_values').val()==''){
			$('#attr_values').val(attr_value);
		}else{
			$('#attr_values').val($('#attr_values').val()+','+attr_value);
		}
		/*if($('#attr_stocks').val()==''){
			$('#attr_stock').val(attr_stock);
		}else{
			$('#attr_stock').val($('#attr_values').val()+','+attr_value);
		}*/
		$('#attrs_titles').val($('#attr_titles').val());
		$('#attrs_values').val($('#attr_values').val());
		$('#attrs_stocks').val($('#attr_stocks').val());
		$('#attr_title').val('');
		$('#attr_value').val('');
		var attrform = $('.form-horizontal');
		var query = attrform.serialize();
		//alert(query);
		$.post("__URL__/getattrlist",query).success(function(data){
			if (data.status==1) {
				//updateAlert(data.attr_str ,'alert-success');
				$('#attr_str').html(data.attr_str);
				$('#attr_html').html(data.attr_html);
			}else{
				updateAlert(data.info);
			}
			setTimeout(function(){
                $('#top-alert').find('button').click();
            },1500);
		})
	}
}
</script>
</block>

<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">

$('#button').click(function(){
	//$('#form').submit();
});

$(function(){
    $('.time').datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });
    showTab();

	<if condition="C('OPEN_DRAFTBOX') and (ACTION_NAME eq 'add' or $info['status'] eq 3)">
	//保存草稿
	var interval;
	$('#autoSave').click(function(){
        var target_form = $(this).attr('target-form');
        var target = $(this).attr('url')
        var form = $('.'+target_form);
        var query = form.serialize();
        var that = this;

        $(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
        $.post(target,query).success(function(data){
            if (data.status==1) {
                updateAlert(data.info ,'alert-success');
                $('input[name=id]').val(data.data.id);
            }else{
                updateAlert(data.info);
            }
            setTimeout(function(){
                $('#top-alert').find('button').click();
                $(that).removeClass('disabled').prop('disabled',false);
            },1500);
        })

        //重新开始定时器
        clearInterval(interval);
        autoSaveDraft();
        return false;
    });

	//Ctrl+S保存草稿
	$('body').keydown(function(e){
		if(e.ctrlKey && e.which == 83){
			$('#autoSave').click();
			return false;
		}
	});

	//每隔一段时间保存草稿
	function autoSaveDraft(){
		interval = setInterval(function(){
			//只有基础信息填写了，才会触发
			var title = $('input[name=title]').val();
			var name = $('input[name=name]').val();
			var des = $('textarea[name=description]').val();
			if(title != '' || name != '' || des != ''){
				$('#autoSave').click();
			}
		}, 1000*parseInt({:C('DRAFT_AOTOSAVE_INTERVAL')}));
	}
	autoSaveDraft();

	</if>

});
</script>
</block>
